﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	测压井观测（每月）
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        DateTime date = (DateTime)ViewData["date"];
        DateTime originalDate = (DateTime)ViewData["originalDate"];
    %>
    <div class="screen_area">
        <form method="Get" action="/Query/PiezometerWell">
        <div>
        <%if ((bool)ViewData["showFactory"])
            {%>
        请选择公司：<%= Html.DropDownList("factoryId", ViewData["factories"] as List<SelectListItem>, "请选择公司", new { onchange = "showStacks();" })%>
        <span style="margin-left:20px"></span>
        <%
            }
            else
            {
        %>
        <%=Html.Hidden("factoryId", ViewData["factoryId"]) %>
        <%
            }
        %>
        <label>请选择堆场/尾矿库：</label><span id="stackList"><%= Html.DropDownList("stackId", ViewData["stacksAndTailingponds"] as List<SelectListItem>, "请选择")%></span>
        <span style="margin-left:20px"></span>
        <label>查询日期：</label><span><input type="text" name="date" id="date" size="12" value="<%=originalDate.Year %>-<%=originalDate.Month %>-<%=originalDate.Day %>" class="ipt_date" readonly="readonly" /></span>
        <span><input type="submit" value="查  询" /></span>
        </div>
        </form>
    </div>
    <div style="margin-top:10px;margin-bottom:10px"></div>
    <div id="dolphincontainer">
	    <div id="dolphinnav">
	        <ul class="top_tab">
                <li><a href="/Query/StackWater?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>水位及水质</span></a></li>
                <li><a href="/Query/BackWater?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>进浆及回水</span></a></li>
                <li><a href="/Query/Settle?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>沉降及位移</span></a></li>
                <li><a href="/Query/Ardealite?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>磷石膏堆积坝</span></a></li>
                <li><a href="/Query/Ditch?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"]%>&factoryId=<%=ViewData["factoryId"] %>"><span>截洪沟</span></a></li>
                <li><a href="javascript:return(false);" class="current"><span>浸润线观测</span></a></li>
                <li><a href="/Query/PiezometerBase?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"]%>&factoryId=<%=ViewData["factoryId"] %>"><span>渗压观测</span></a></li>
                <li><a href="/Query/Drain?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"]%>&factoryId=<%=ViewData["factoryId"] %>"><span>导渗系统</span></a></li>
	        </ul>
	    </div>
	</div>

    <%
         List<Piezometer_well_base_info> wells = (List<Piezometer_well_base_info>)ViewData["wells"];
         List<Piezometer_well_monthly_info> wellsRecord = (List<Piezometer_well_monthly_info>)ViewData["wellsRecord"];
         DateTime preDate = originalDate.AddMonths(-1);
         DateTime nextDate = originalDate.AddMonths(1);
    %>

    <div class="dataarea">
        <a class="arrow_l" href="/Query/PiezometerWell?stackId=<%=ViewData["stackId"]%>&date=<%=preDate%>&factoryId=<%=ViewData["factoryId"] %>" title="前一月">前一月</a>
        <strong><%= date.Year%>年<%=date.Month%>月</strong><%if (originalDate.Date < DateTime.Now.Date && (originalDate.Date.Year < DateTime.Now.Date.Year || originalDate.Date.Month < DateTime.Now.Date.Month)) { %>
        <a class="arrow_r" href="/Query/PiezometerWell?stackId=<%=ViewData["stackId"]%>&date=<%=nextDate%>&factoryId=<%=ViewData["factoryId"] %>" title="后一月">后一月</a><%} %>
    </div>
    
    <table cellpadding="4" cellspacing="0" class="com_from_table" style="width:756px;">
        
        <tr>
            <td class="lab" style="width:138px;">测量人员：</td>
            <td style="width:608px;">
                <%
                    User tester = (User) ViewData["tester"];
                    if (tester != null)
                    {
                %>
                <%=tester.RealName + " (" + tester.Name + ")"%>
                <%
                    }
                %>&nbsp;&nbsp;
            </td>
        </tr>

    </table>

    <table cellpadding="4" cellspacing="0" class="com_from_table3" style="width:756px;">
        <tr>
            <th style="width:100px;">测压井编号</th>
            <th style="width:100px;">孔顶标高（米）</th>
            <th style="width:100px;">孔底标高（米）</th>
            <th style="width:180px;">孔顶标高与井中水位高差（米）</th>
            <th>说明</th>
        </tr>

        <%
            if (wells != null & wells.Count > 0)
            {
                for (int i = 0; i < wells.Count; i++)
                {
                    bool hasRecord = wellsRecord != null && wellsRecord.Count > i;
        %>

        <tr>
            <td style="text-align:center;"><%=wells[i].piezometer_well_id%></td>
            <td style="text-align:center;"><%=wells[i].well_top_El%></td>
            <td style="text-align:center;"><%=wells[i].Well_bottom_El%></td>
            <td style="text-align:center;"><%=hasRecord ? (wellsRecord[i].Height_difference.HasValue ? wellsRecord[i].Height_difference.Value.ToString() : "&nbsp;"): "&nbsp;"%></td>
            <td><%=hasRecord ? wellsRecord[i].Remarks : "&nbsp;"%></td>
        </tr>

        <%
                }
            }
        %>
    </table>

    <script type="text/javascript" language="javascript">
        $('#date').datepicker({ changeMonth: true, changeYear: true });

        function showStacks() {
            var factoryId = document.getElementById("factoryId").value;
            if (factoryId == "" || factoryId == 0) return;
            $.ajax({ 
                    type: "POST",
                    url: "<%=Url.Content("~/Modification/ListStacks") %>",
                    data: "factoryId=" + factoryId,
                    success: function (data) { $("#stackList").html(data);}
            });
        }
    </script>
</asp:Content>
